<template>
  <div class="admin-dashboard">
    <!-- 小猫数据分析师动画 - 移到顶部 -->
    <div class="cat-playground">
      <div class="cat-analyst-scene">
        <div class="data-dashboard">
          <div class="dashboard-screen">
            <div class="data-chart">
              <div class="chart-line"></div>
              <div class="chart-line"></div>
              <div class="chart-line"></div>
              <div class="chart-dot"></div>
              <div class="chart-dot"></div>
              <div class="chart-dot"></div>
            </div>
          </div>
          <div class="dashboard-stand"></div>
        </div>
        
        <div class="analyst-cat">
          <div class="cat-head">
            <div class="cat-ear left"></div>
            <div class="cat-ear right"></div>
            <div class="cat-face">
              <div class="cat-eyes">
                <div class="cat-eye left"></div>
                <div class="cat-eye right"></div>
              </div>
              <div class="cat-nose"></div>
            </div>
            <div class="cat-glasses"></div>
          </div>
          <div class="cat-body">
            <div class="cat-paw left"></div>
            <div class="cat-paw right"></div>
            <div class="cat-tail"></div>
          </div>
        </div>
        
        <div class="desk"></div>
        
        <div class="coffee-cup">
          <div class="cup-body">
            <div class="cup-steam">
              <div class="steam-particle"></div>
              <div class="steam-particle"></div>
              <div class="steam-particle"></div>
            </div>
          </div>
          <div class="cup-handle"></div>
        </div>
      </div>
      
      <div class="data-insight-bubble">
        <div class="insight-text">欢迎来到碳减排管理平台！今日数据表现优异！</div>
        <div class="insight-emoji">📊</div>
      </div>
    </div>
    
    <!-- 概览卡片 -->
    <div class="stats-cards">
      <div class="admin-card stats-card">
        <div class="stats-icon users-icon">👥</div>
        <div class="stats-info">
          <div class="stats-title">用户总数</div>
          <div class="stats-value">{{ statsData.users.total }}</div>
          <div class="stats-trend positive">
            <span class="trend-icon">↑</span>
            <span class="trend-value">{{ statsData.users.trend }}%</span>
            <span class="trend-period">较上周</span>
          </div>
        </div>
      </div>
      
      <div class="admin-card stats-card">
        <div class="stats-icon challenges-icon">🏆</div>
        <div class="stats-info">
          <div class="stats-title">挑战总数</div>
          <div class="stats-value">{{ statsData.challenges.total }}</div>
          <div class="stats-trend positive">
            <span class="trend-icon">↑</span>
            <span class="trend-value">{{ statsData.challenges.trend }}%</span>
            <span class="trend-period">较上周</span>
          </div>
        </div>
      </div>
      
      <div class="admin-card stats-card">
        <div class="stats-icon tasks-icon">📝</div>
        <div class="stats-info">
          <div class="stats-title">任务完成率</div>
          <div class="stats-value">{{ statsData.tasks.completionRate }}%</div>
          <div class="stats-trend negative">
            <span class="trend-icon">↓</span>
            <span class="trend-value">{{ statsData.tasks.trend }}%</span>
            <span class="trend-period">较上周</span>
          </div>
        </div>
      </div>
      
      <div class="admin-card stats-card">
        <div class="stats-icon points-icon">🎁</div>
        <div class="stats-info">
          <div class="stats-title">积分兑换量</div>
          <div class="stats-value">{{ statsData.points.total }}</div>
          <div class="stats-trend positive">
            <span class="trend-icon">↑</span>
            <span class="trend-value">{{ statsData.points.trend }}%</span>
            <span class="trend-period">较上周</span>
          </div>
        </div>
      </div>
    </div>
    
    <!-- 数据图表 -->
    <div class="charts-section">
      <div class="charts-row">
        <div class="admin-card chart-card">
          <div class="admin-card-header">
            <h3>用户增长趋势</h3>
            <div class="card-actions">
              <select class="chart-period-selector" v-model="userGrowthData.period">
                <option value="week">本周</option>
                <option value="month" selected>本月</option>
                <option value="year">本年</option>
              </select>
            </div>
          </div>
          <div class="admin-card-body">
            <div class="chart-placeholder user-growth-chart">
              <div class="chart-bars">
                <div class="chart-bar" style="height: 30%"></div>
                <div class="chart-bar" style="height: 50%"></div>
                <div class="chart-bar" style="height: 40%"></div>
                <div class="chart-bar" style="height: 70%"></div>
                <div class="chart-bar" style="height: 60%"></div>
                <div class="chart-bar" style="height: 80%"></div>
                <div class="chart-bar active" style="height: 90%"></div>
              </div>
              <div class="chart-labels">
                <span>周一</span>
                <span>周二</span>
                <span>周三</span>
                <span>周四</span>
                <span>周五</span>
                <span>周六</span>
                <span>周日</span>
              </div>
            </div>
          </div>
        </div>
        
        <div class="admin-card chart-card">
          <div class="admin-card-header">
            <h3>挑战参与情况</h3>
            <div class="card-actions">
              <span class="chart-legend">
                <span class="legend-dot active-dot"></span>
                <span class="legend-text">活跃挑战</span>
              </span>
              <span class="chart-legend">
                <span class="legend-dot completed-dot"></span>
                <span class="legend-text">已完成</span>
              </span>
            </div>
          </div>
          <div class="admin-card-body">
            <div class="chart-placeholder challenge-stats-chart">
              <div class="pie-chart">
                <div class="pie-segment" style="--percentage: 65%; --color: #1890ff"></div>
                <div class="pie-segment" style="--percentage: 35%; --color: #52c41a"></div>
                <div class="pie-center">65%</div>
              </div>
              <div class="pie-chart-legend">
                <div class="legend-item">
                  <div class="legend-color" style="background-color: #1890ff"></div>
                  <div class="legend-label">活跃挑战</div>
                  <div class="legend-value">{{ challengeStats.active }}</div>
                </div>
                <div class="legend-item">
                  <div class="legend-color" style="background-color: #52c41a"></div>
                  <div class="legend-label">已完成挑战</div>
                  <div class="legend-value">{{ challengeStats.completed }}</div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      
      <div class="admin-card">
        <div class="admin-card-header">
          <h3>任务完成趋势</h3>
          <div class="card-actions">
            <button class="chart-action-btn active" v-for="(period, index) in chartPeriods" :key="index" @click="changeTaskTrendPeriod(period)">{{ period }}</button>
          </div>
        </div>
        <div class="admin-card-body">
          <div class="chart-placeholder task-trend-chart">
            <div class="line-chart">
              <svg viewBox="0 0 800 200" class="chart-svg">
                <!-- 网格线 -->
                <line x1="0" y1="0" x2="800" y2="0" class="grid-line"></line>
                <line x1="0" y1="50" x2="800" y2="50" class="grid-line"></line>
                <line x1="0" y1="100" x2="800" y2="100" class="grid-line"></line>
                <line x1="0" y1="150" x2="800" y2="150" class="grid-line"></line>
                <line x1="0" y1="200" x2="800" y2="200" class="grid-line"></line>
                
                <!-- 折线 -->
                <polyline
                  fill="none"
                  stroke="#1890ff"
                  stroke-width="3"
                  points="
                    0,120
                    100,100
                    200,140
                    300,90
                    400,50
                    500,70
                    600,40
                    700,60
                    800,30
                  "
                ></polyline>
                
                <!-- 区域填充 -->
                <path
                  fill="rgba(24, 144, 255, 0.1)"
                  d="
                    M0,120
                    L100,100
                    L200,140
                    L300,90
                    L400,50
                    L500,70
                    L600,40
                    L700,60
                    L800,30
                    L800,200
                    L0,200
                    Z
                  "
                ></path>
                
                <!-- 数据点 -->
                <circle cx="0" cy="120" r="4" fill="#1890ff"></circle>
                <circle cx="100" cy="100" r="4" fill="#1890ff"></circle>
                <circle cx="200" cy="140" r="4" fill="#1890ff"></circle>
                <circle cx="300" cy="90" r="4" fill="#1890ff"></circle>
                <circle cx="400" cy="50" r="4" fill="#1890ff"></circle>
                <circle cx="500" cy="70" r="4" fill="#1890ff"></circle>
                <circle cx="600" cy="40" r="4" fill="#1890ff"></circle>
                <circle cx="700" cy="60" r="4" fill="#1890ff"></circle>
                <circle cx="800" cy="30" r="4" fill="#1890ff"></circle>
              </svg>
              
              <div class="chart-labels">
                <span>1/1</span>
                <span>1/2</span>
                <span>1/3</span>
                <span>1/4</span>
                <span>1/5</span>
                <span>1/6</span>
                <span>1/7</span>
                <span>1/8</span>
                <span>1/9</span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    
    <!-- 最近活动和快捷操作 -->
    <div class="bottom-section">
      <div class="admin-card recent-activities">
        <div class="admin-card-header">
          <h3>最近活动</h3>
          <div class="card-actions">
            <button class="admin-btn" @click="viewAllActivities">查看全部</button>
          </div>
        </div>
        <div class="admin-card-body">
          <div class="activity-list">
            <div class="activity-item" v-for="(activity, index) in recentActivities" :key="index">
              <div class="activity-icon" :class="`${activity.type}-icon`">👤</div>
              <div class="activity-content">
                <div class="activity-title">{{ activity.title }}</div>
                <div class="activity-description">{{ activity.description }}</div>
                <div class="activity-time">{{ activity.time }}</div>
              </div>
            </div>
          </div>
        </div>
      </div>
      
      <div class="admin-card quick-actions">
        <div class="admin-card-header">
          <h3>快捷操作</h3>
        </div>
        <div class="admin-card-body">
          <div class="action-buttons">
            <button class="action-button" @click="performQuickAction('newChallenge')">
              <span class="action-icon">➕</span>
              <span class="action-text">新建挑战</span>
            </button>
            
            <button class="action-button" @click="performQuickAction('newTask')">
              <span class="action-icon">📝</span>
              <span class="action-text">新建任务</span>
            </button>
            
            <button class="action-button" @click="performQuickAction('newArticle')">
              <span class="action-icon">📰</span>
              <span class="action-text">发布文章</span>
            </button>
            
            <button class="action-button" @click="performQuickAction('newProduct')">
              <span class="action-icon">🎁</span>
              <span class="action-text">添加商品</span>
            </button>
            
            <button class="action-button" @click="performQuickAction('exportData')">
              <span class="action-icon">📊</span>
              <span class="action-text">数据导出</span>
            </button>
            
            <button class="action-button" @click="performQuickAction('settings')">
              <span class="action-icon">⚙️</span>
              <span class="action-text">系统设置</span>
            </button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'AdminDashboard',
  data() {
    return {
      // 模拟数据 - 实际应用中这些数据会从API获取
      statsData: {
        users: {
          total: 1234,
          trend: 5.2,
          isPositive: true
        },
        challenges: {
          total: 45,
          trend: 2.8,
          isPositive: true
        },
        tasks: {
          completionRate: 76.3,
          trend: 1.5,
          isPositive: false
        },
        points: {
          total: 3582,
          trend: 12.7,
          isPositive: true
        }
      },
      userGrowthData: {
        period: 'month',
        data: [30, 50, 40, 70, 60, 80, 90]
      },
      challengeStats: {
        active: 28,
        completed: 17,
        activePercentage: 65
      },
      taskTrendData: {
        period: 'day',
        dates: ['1/1', '1/2', '1/3', '1/4', '1/5', '1/6', '1/7', '1/8', '1/9'],
        values: [120, 100, 140, 90, 50, 70, 40, 60, 30]
      },
      recentActivities: [
        {
          type: 'user',
          title: '新用户注册',
          description: '用户 <strong>张三</strong> 完成了注册',
          time: '10分钟前'
        },
        {
          type: 'challenge',
          title: '挑战完成',
          description: '用户 <strong>李四</strong> 完成了 <strong>7天低碳出行</strong> 挑战',
          time: '30分钟前'
        },
        {
          type: 'task',
          title: '任务提交',
          description: '用户 <strong>王五</strong> 提交了 <strong>节水行动</strong> 任务',
          time: '1小时前'
        },
        {
          type: 'point',
          title: '积分兑换',
          description: '用户 <strong>赵六</strong> 兑换了 <strong>环保水杯</strong>',
          time: '2小时前'
        },
        {
          type: 'article',
          title: '新文章发布',
          description: '管理员发布了文章 <strong>《如何减少日常碳排放》</strong>',
          time: '3小时前'
        }
      ]
    }
  },
  computed: {
    chartPeriods() {
      return {
        day: '日',
        week: '周',
        month: '月'
      }
    }
  },
  methods: {
    // 更改用户增长图表周期
    changeUserGrowthPeriod(period) {
      this.userGrowthData.period = period;
      // 实际应用中这里会重新从API获取数据
      console.log('切换用户增长周期到:', period);
    },
    
    // 更改任务趋势图表周期
    changeTaskTrendPeriod(period) {
      this.taskTrendData.period = period;
      // 实际应用中这里会重新从API获取数据
      console.log('切换任务趋势周期到:', period);
    },
    
    // 执行快捷操作
    performQuickAction(action) {
      // 根据不同的操作跳转到不同的页面
      const actionRoutes = {
        'newChallenge': '/admin/challenges/new',
        'newTask': '/admin/tasks/new',
        'newArticle': '/admin/articles/new',
        'newProduct': '/admin/points/new',
        'exportData': '/admin/settings',
        'settings': '/admin/settings'
      };
      
      if (actionRoutes[action]) {
        this.$router.push(actionRoutes[action]);
      }
    },
    
    // 查看所有最近活动
    viewAllActivities() {
      this.$router.push('/admin/logs');
    }
  }
}
</script>

<style scoped>
.admin-dashboard {
  width: 100%;
  padding: 0;
}

.cat-playground {
  position: relative;
  height: 200px;
  margin: 0;
  background-color: rgba(252, 248, 255, 0.6);
  border-radius: 0;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.05);
  overflow: hidden;
}

.cat-analyst-scene {
  position: relative;
  height: 100%;
  padding: 20px;
}

.analyst-cat {
  position: absolute;
  bottom: 55px;
  left: 180px;
  width: 80px;
  height: 80px;
  z-index: 5;
}

.cat-head {
  position: absolute;
  width: 45px;
  height: 45px;
  background-color: #8e7cc3;
  border-radius: 50%;
  top: -20px;
  left: 20px;
  z-index: 6;
}

.cat-ear {
  position: absolute;
  width: 0;
  height: 0;
  border-bottom: 16px solid #8e7cc3;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  top: -12px;
}

.cat-ear.left {
  left: -5px;
  transform: rotate(-30deg);
}

.cat-ear.right {
  right: -5px;
  transform: rotate(30deg);
}

.cat-face {
  position: relative;
  padding-top: 18px;
}

.cat-eyes {
  display: flex;
  justify-content: space-evenly;
}

.cat-eye {
  width: 8px;
  height: 8px;
  background-color: #333;
  border-radius: 50%;
  animation: blink 4s infinite;
}

@keyframes blink {
  0%, 96%, 100% { transform: scaleY(1); }
  98% { transform: scaleY(0.1); }
}

.cat-nose {
  width: 6px;
  height: 4px;
  background-color: #e58c8a;
  border-radius: 50%;
  margin: 4px auto 0;
}

.cat-glasses {
  position: absolute;
  top: 20px;
  left: 0;
  width: 100%;
  height: 12px;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.cat-glasses:before, .cat-glasses:after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid #666;
  border-radius: 50%;
  position: absolute;
  top: 0;
}

.cat-glasses:before {
  left: 6px;
}

.cat-glasses:after {
  right: 6px;
}

.cat-glasses:after {
  content: '';
  position: absolute;
  top: 7px;
  left: 22px;
  width: 5px;
  height: 2px;
  background-color: #666;
}

.cat-body {
  position: absolute;
  width: 60px;
  height: 40px;
  background-color: #8e7cc3;
  border-radius: 30px / 20px;
  top: 20px;
  left: 10px;
}

.cat-paw {
  position: absolute;
  width: 20px;
  height: 8px;
  background-color: #8e7cc3;
  border-radius: 5px;
  bottom: -5px;
}

.cat-paw.left {
  left: 10px;
}

.cat-paw.right {
  right: 10px;
}

.cat-tail {
  position: absolute;
  width: 35px;
  height: 10px;
  background-color: #8e7cc3;
  border-radius: 5px;
  right: -15px;
  top: 15px;
  transform-origin: left center;
  animation: tail-wiggle 3s infinite ease-in-out;
}

@keyframes tail-wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(10deg); }
  50% { transform: rotate(0deg); }
  75% { transform: rotate(-10deg); }
}

.data-dashboard {
  position: absolute;
  bottom: 60px;
  left: 100px;
  z-index: 3;
}

.dashboard-screen {
  width: 100px;
  height: 70px;
  background-color: #f5f5f5;
  border: 3px solid #333;
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.data-chart {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  overflow: hidden;
}

.chart-line {
  position: absolute;
  height: 1px;
  background-color: #1890ff;
}

.chart-line:nth-child(1) {
  width: 80%;
  top: 15px;
  animation: chart-grow 3s infinite;
}

.chart-line:nth-child(2) {
  width: 60%;
  top: 30px;
  animation: chart-grow 3s infinite 1s;
}

.chart-line:nth-child(3) {
  width: 70%;
  top: 45px;
  animation: chart-grow 3s infinite 2s;
}

@keyframes chart-grow {
  0% { width: 0; }
  50% { width: 80%; }
  100% { width: 0; }
}

.chart-dot {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: #ff4d4f;
}

.chart-dot:nth-child(4) {
  top: 15px;
  left: 20%;
  animation: dot-pulse 3s infinite;
}

.chart-dot:nth-child(5) {
  top: 30px;
  left: 50%;
  animation: dot-pulse 3s infinite 1s;
}

.chart-dot:nth-child(6) {
  top: 45px;
  left: 35%;
  animation: dot-pulse 3s infinite 2s;
}

@keyframes dot-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.5); }
}

.dashboard-stand {
  width: 20px;
  height: 10px;
  background-color: #333;
  margin: 0 auto;
}

.desk {
  position: absolute;
  bottom: 20px;
  left: 70px;
  width: 350px;
  height: 15px;
  background-color: #a88c5b;
  border-radius: 5px;
  z-index: 2;
}

.desk:after {
  content: '';
  position: absolute;
  top: 15px;
  left: 30px;
  width: 280px;
  height: 15px;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 50%;
  filter: blur(5px);
}

.coffee-cup {
  position: absolute;
  bottom: 75px;
  right: 120px;
  z-index: 4;
}

.cup-body {
  width: 25px;
  height: 30px;
  background-color: #fff;
  border: 2px solid #333;
  border-radius: 0 0 10px 10px;
  position: relative;
  overflow: hidden;
}

.cup-body:before {
  content: '';
  position: absolute;
  top: 5px;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #ca8a04;
  border-radius: 5px;
}

.cup-handle {
  position: absolute;
  width: 10px;
  height: 15px;
  border: 2px solid #333;
  border-radius: 0 10px 10px 0;
  border-left: none;
  right: -10px;
  top: 8px;
}

.cup-steam {
  position: absolute;
  top: -15px;
  left: 5px;
}

.steam-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  background-color: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  animation: steam-rise 3s infinite ease-out;
}

.steam-particle:nth-child(1) {
  left: 0;
  animation-delay: 0s;
}

.steam-particle:nth-child(2) {
  left: 7px;
  animation-delay: 0.6s;
}

.steam-particle:nth-child(3) {
  left: 3px;
  animation-delay: 1.2s;
}

@keyframes steam-rise {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.5);
  }
  50% {
    opacity: 0.6;
  }
  100% {
    opacity: 0;
    transform: translateY(-15px) scale(1) rotate(5deg);
  }
}

.data-insight-bubble {
  position: absolute;
  top: 30px;
  right: 50px;
  background-color: white;
  padding: 10px 15px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 250px;
}

.data-insight-bubble:before {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 20px;
  border-top: 10px solid white;
  border-right: 10px solid transparent;
  border-left: 10px solid transparent;
}

.insight-text {
  font-size: 14px;
  color: #333;
}

.insight-emoji {
  font-size: 18px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* 统计卡片样式 */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.stats-card {
  display: flex;
  align-items: center;
  padding: 20px;
}

.stats-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  margin-right: 16px;
}

.users-icon {
  background-color: #e6f7ff;
  color: #1890ff;
}

.challenges-icon {
  background-color: #fff7e6;
  color: #fa8c16;
}

.tasks-icon {
  background-color: #f6ffed;
  color: #52c41a;
}

.points-icon {
  background-color: #f9f0ff;
  color: #722ed1;
}

.stats-info {
  flex: 1;
}

.stats-title {
  font-size: 14px;
  color: rgba(0, 0, 0, 0.45);
  margin-bottom: 8px;
}

.stats-value {
  font-size: 24px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.85);
  margin-bottom: 8px;
}

.stats-trend {
  font-size: 14px;
  display: flex;
  align-items: center;
}

.stats-trend.positive {
  color: #52c41a;
}

.stats-trend.negative {
  color: #ff4d4f;
}

.trend-icon {
  margin-right: 4px;
}

.trend-period {
  margin-left: 8px;
  color: rgba(0, 0, 0, 0.45);
}

/* 图表卡片样式 */
.charts-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.charts-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.chart-card {
  height: 350px;
}

.card-actions {
  display: flex;
  align-items: center;
}

.chart-period-selector {
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #d9d9d9;
  background-color: white;
}

.chart-legend {
  display: flex;
  align-items: center;
  margin-left: 16px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
}

.active-dot {
  background-color: #1890ff;
}

.completed-dot {
  background-color: #52c41a;
}

.legend-text {
  font-size: 14px;
  color: rgba(0, 0, 0, 0.65);
}

.chart-action-btn {
  padding: 4px 8px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  background-color: white;
  cursor: pointer;
  margin-left: 8px;
}

.chart-action-btn.active {
  background-color: #1890ff;
  color: white;
  border-color: #1890ff;
}

/* 图表占位符样式 */
.chart-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* 柱状图样式 */
.chart-bars {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
  height: 200px;
  padding: 0 20px;
}

.chart-bar {
  width: 30px;
  background-color: #e6f7ff;
  position: relative;
  transition: all 0.3s;
}

.chart-bar:hover {
  background-color: #bae7ff;
}

.chart-bar.active {
  background-color: #1890ff;
}

.chart-labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 0 20px;
  margin-top: 8px;
}

.chart-labels span {
  font-size: 12px;
  color: rgba(0, 0, 0, 0.65);
  flex: 1;
  text-align: center;
}

/* 饼图样式 */
.pie-chart {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  position: relative;
  background-color: #f5f5f5;
  margin-bottom: 24px;
}

.pie-segment {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  clip-path: polygon(50% 50%, 50% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 0%, 50% 0%);
  background-color: var(--color);
  transform: rotate(calc(3.6deg * (100 - var(--percentage))));
}

.pie-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background-color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.85);
}

.pie-chart-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.legend-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  margin-bottom: 4px;
}

.legend-label {
  font-size: 14px;
  color: rgba(0, 0, 0, 0.65);
  margin-bottom: 4px;
}

.legend-value {
  font-size: 16px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.85);
}

/* 折线图样式 */
.line-chart {
  width: 100%;
  height: 250px;
  position: relative;
}

.chart-svg {
  width: 100%;
  height: 200px;
}

.grid-line {
  stroke: #f0f0f0;
  stroke-width: 1;
}

/* 最近活动和快捷操作 */
.bottom-section {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.activity-item {
  display: flex;
  padding: 12px;
  border-radius: 4px;
  transition: background-color 0.3s;
}

.activity-item:hover {
  background-color: #f5f5f5;
}

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 18px;
  margin-right: 12px;
}

.user-icon {
  background-color: #e6f7ff;
  color: #1890ff;
}

.challenge-icon {
  background-color: #fff7e6;
  color: #fa8c16;
}

.task-icon {
  background-color: #f6ffed;
  color: #52c41a;
}

.point-icon {
  background-color: #f9f0ff;
  color: #722ed1;
}

.article-icon {
  background-color: #fff0f6;
  color: #eb2f96;
}

.activity-content {
  flex: 1;
}

.activity-title {
  font-weight: 500;
  color: rgba(0, 0, 0, 0.85);
  margin-bottom: 4px;
}

.activity-description {
  color: rgba(0, 0, 0, 0.65);
  margin-bottom: 4px;
}

.activity-time {
  font-size: 12px;
  color: rgba(0, 0, 0, 0.45);
}

.action-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.action-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100px;
  background-color: #f5f5f5;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
}

.action-button:hover {
  background-color: #e6f7ff;
  transform: translateY(-2px);
}

.action-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.action-text {
  font-size: 14px;
  font-weight: 500;
}

/* 响应式调整 */
@media (max-width: 1200px) {
  .stats-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .charts-row {
    grid-template-columns: 1fr;
  }
  
  .bottom-section {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .stats-cards {
    grid-template-columns: 1fr;
  }
  
  .action-buttons {
    grid-template-columns: 1fr;
  }
}
</style> 